home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
hp16c.emu
< prev
next >
Wrap
Text File
|
1995-03-23
|
3KB
|
210 lines
Article 1641 of comp.sys.handhelds:
From: fin@norge.unet.umn.edu (Craig A. Finseth)
Subject: HP-16 emulator
Date: 27 Mar 90 21:35:45 GMT
Organization: Univ Netw Serv, Univ of Minn
Here is my HP-16 emulator code. No, it doesn't do quite everything
but it does use the vectored Enter key to add "#" characters...
------------------------------------------------------------
Written by: Craig Finseth, University of Minnesota
From: 24 Mar 1990
What: Partial HP-16C Emulator
ON16 Turn on our special ENTER key.
OFF16 Turn off our special ENTER key.
BASE MATH:BASE menu.
LJ Left Justify
MSKL Mask Left
MSKR Mask Right
RLn Rotate Left by n
RRn Rotate Right by n
RLC Rotate Left through Carry
RRC Rotate Right through Carry
RLCn Rotate Left by n through Carry
RRCn Rotate Right by n through Carry
CNTB Count the number of "1" bits
SB Set a bit
CB Clear a bit
TB Test a bit
TOBIN Convert an expression to a binary number.
TOREAL Convert an expression to a real number.
TRIMN Trim N to the current word size.
SWAPC Swap the bottom bit of the current value with the carry bit.
CARRY The carry bit.
alphaENTER Our vectored Enter key. This key checks to see if the
first character of the command string is a digit ("0"
through "9"). If so, it prepends a "#" character to the
command line.
Note: The USER mode must be active for this to work.
HP-16C Functions Not Emulated:
RMD
DBLR
DBL/
DBL*
1's mode
UNSGN mode
All other HP-16C functions exist in the HP-48SX (e.g., RR, RL, ASR) or
are implemented in a better way in the HP-48SX (e.g., program
control).
Checksum: #17d
Size: 1420.5
------------------------------------------------------------
%%HP: T(3)A(D)F(.);
DIR
ON16
\<< -62 SF -63 SF
\>>
OFF16
\<< -62 CF -63 CF
\>>
BASE
\<< 9 MENU
\>>
LJ
\<< DUP
IF TOREAL
THEN TOBIN
DO RL DUP
UNTIL # 1d
AND TOREAL
END RR
ELSE # 0d
END
\>>
MSKL
\<< TRIMN \-> n
\<< # 0d 1 n
START RR
# 1d RR OR
NEXT
\>>
\>>
MSKR
\<< TRIMN \-> n
\<< # 0d 1 n
START SL
# 1d OR
NEXT
\>>
\>>
RLn
\<< \-> X n
\<< X TOBIN 1 n
TRIMN
START RL
NEXT
\>>
\>>
RRn
\<< \-> X n
\<< X TOBIN 1 n
TRIMN
START RR
NEXT
\>>
\>>
RLC
\<< TOBIN RL
SWAPC
\>>
RRC
\<< TOBIN SWAPC
RR
\>>
RLCn
\<< \-> X n
\<< X TOBIN 1 n
TRIMN
START RLC
NEXT
\>>
\>>
RRCn
\<< \-> X n
\<< X TOBIN 1 n
TRIMN
START RRC
NEXT
\>>
\>>
CNTB
\<< 0 SWAP TOBIN
1 RCWS
START
IF DUP # 1d
AND TOREAL
THEN SWAP 1
+ SWAP
END RR
NEXT DROP
\>>
SB
\<< # 1d SWAP RLn
OR
\>>
CB
\<< # 1d NOT SWAP
RLn AND
\>>
TB
\<< RRn # 1d AND
\>>
TOBIN
\<< \->NUM \-> X
\<<
IF X TYPE
10 \=/
THEN X RE
R\->B
ELSE X
END
\>>
\>>
TOREAL
\<< \->NUM \-> X
\<<
IF X TYPE
10 ==
THEN X B\->R
ELSE X
END
\>>
\>>
TRIMN
\<< TOREAL ABS
RCWS MOD
\>>
SWAPC
\<< DUP CARRY
SWAP # 1d AND
'CARRY' STO SWAP
# 1d NOT AND OR
\>>
CARRY # 0d
\GaENTER
\<< \-> X
\<< X 1 1 SUB
NUM \-> Y
\<<
IF Y 48 \>=
Y 57 \<= AND
THEN "#"
X +
ELSE X
END
\>>
\>> OBJ\->
\>>
END